<?php 
$agcyID = $_GET['Id'];
$query = "select * from tbl_whis_carriers";
$result = mysql_query($query);

$agcy_query = "select * from tbl_agency_agreement where agency_agreement_id = $agcyID";
$agy_result = mysql_fetch_array(mysql_query($agcy_query));

if($_POST['agency_agre'] == 'agency_agre')
{
extract($_POST);
$update_query = "UPDATE tbl_agency_agreement SET qry_lec_companies='$qry_lec_companies',whls_carriers='$whls_carriers'," .
		"qry_ixc_companies='$qry_ixc_companies',effective_start_date='$effective_start_date',effective_end_date='$effective_end_date' WHERE agency_agreement_id=$agcyID";
if(mysql_query($update_query)){?>
<script>
$(document).ready(function(){
$("#success").text("Agency Agreement Updated Successfully!").show().fadeOut(5000);
return false;
});
</script>
<?}
$agcy_query = "select * from tbl_agency_agreement where agency_agreement_id = $agcyID";
$agy_result = mysql_fetch_array(mysql_query($agcy_query));
}
?>
<span id='error'></span><span id='success'></span>
<fieldset>
<legend><strong>Agency Agreement</strong></legend>
	<div>
	<form action="index.php?page=edit-agency-agreement&Id=<?=$agcyID?>" method="post">
		<table cellpadding="4">
		<tr>
			<td><label><strong>LEC Nickname</strong></label>:</td>
			<td><select name="qry_lec_companies">
										<option value="LEC_company1">LEC company1</option>
										<option value="LEC_company2">LEC company2</option>
										<option value="LEC_company3">LEC company3</option>
										<option value="LEC_company4">LEC company4</option>
									</select></td>
		</tr>
		<tr>
			<td><label><strong>Wholesale Carrier CIC Code :</label></strong></td>
			<td>
			<select name="whls_carriers">
			<? while($row = mysql_fetch_array($result)){?>
				<option value=<? echo $row['whls_carriers_name'];?>><? echo $row['whls_carriers_name'];?></option>
			<? }?>
			</select>
			</td>
		</tr>
		<tr>
			<td><label><strong>IXC Nickname :</label></strong></td>
			<td>
			<select name="qry_ixc_companies">
										<option value="IXC_company1">IXC company1</option>
										<option value="IXC_company2">IXC company2</option>
										<option value="IXC_company3">IXC company3</option>
										<option value="IXC_company4">IXC company4</option>
			</select>
			</td>
			</td>
		</tr>
		<tr>
			<td><label><strong>Effective Start Date* :</label></strong></td>
			<td><input type="text" name="effective_start_date" id="datepicker3" class="required" value="<?=$agy_result['effective_start_date']?>"/></td>
		</tr>
		<tr>
			<td><label><strong>Effective End Date* :</label></strong></td>
			<td><input type="text" name="effective_end_date" id="datepicker4" class="required" value="<?=$agy_result['effective_end_date']?>"/></td>
		</tr>
		<tr>
			<td>&nbsp;<input type="hidden" value="agency_agre" name="agency_agre" /></td>
			<td><input type="submit" value="submit" name="submit" /></td>
		</tr>
	</table>
	</form>
	</div>
</fieldset>